const app = getApp()
Component({
  data: {
    selected:0,
    color: "#bfbfbf",
    selectedColor: "#3883FA",
    list: [{
      "text": "团队介绍",
      "pagePath": "../teamShow/index",
      "iconPath": "cloud://zyzw-6gm5tqv40fadd81d.7a79-zyzw-6gm5tqv40fadd81d-1305232271/团队 (1).png",
      "selectedIconPath": "cloud://zyzw-6gm5tqv40fadd81d.7a79-zyzw-6gm5tqv40fadd81d-1305232271/团队.png"
    },
    {
      "text": "车辆状况",
      "pagePath": "../carStatus/index",
      "iconPath": "cloud://zyzw-6gm5tqv40fadd81d.7a79-zyzw-6gm5tqv40fadd81d-1305232271/车 (1).png",
      "selectedIconPath": "cloud://zyzw-6gm5tqv40fadd81d.7a79-zyzw-6gm5tqv40fadd81d-1305232271/车.png"
    },
    {
      "text": "个人中心",
      "pagePath": "../userInfo/index",
      "iconPath": "cloud://zyzw-6gm5tqv40fadd81d.7a79-zyzw-6gm5tqv40fadd81d-1305232271/tou_gerenzhuye (2).png",
      "selectedIconPath": "cloud://zyzw-6gm5tqv40fadd81d.7a79-zyzw-6gm5tqv40fadd81d-1305232271/tou_gerenzhuye.png"
    }]
  },
  properties:{
    tabbarIndex:Number
  },
  attached() {
    this.setData({
      selected:app.globalData.tabbarNum
    })
  },
  methods: {
    // switchTab(e) {
    //   console.log(e)
    //   const data = e.currentTarget.dataset
    //   const url = data.path
    //   wx.switchTab({url})
    //   this.setData({
    //     selected: data.index
    //   })
    // }
    handleChange ({ detail }) {
      const that = this
      console.log(detail)
      let current = parseInt(detail.key)
      console.log(current)
      let url = that.data.list[current].pagePath
      app.globalData.tabbarNum = current
      wx.switchTab({url})
  }
  }
})